home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / INTR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  691 b   |  26 lines

  1. /* INTR.C --- p. 635 */
  2. #include <stdio.h>
  3. #include <dos.h>
  4.                 /* Interrupt number for DOS functions */
  5. #define DOS_INT 0x21
  6.                 /* DOS "change directory" function */
  7. #define DOS_CHDIR 0x3b
  8.                 /* Buffer to hold path name */
  9. static char buff[80];
  10. main()
  11. {
  12.                 /* Far pointer to directory name string*/
  13.     char *dirname;
  14.                 /* Set up the structure for registers */
  15.     struct regpack regs;
  16.     printf("Enter pathname: ");
  17.     gets(buff);
  18.                 /* Set up far pointer to name*/
  19.     dirname = &buff[0];
  20.     regs.r_ax = DOS_CHDIR << 8;
  21.                 /* Offset of string to DX    */
  22.     regs.r_dx = FP_OFF(dirname);
  23.                 /* Segment of string to DS    */
  24.     regs.r_ds = FP_SEG(dirname);
  25.     intr(DOS_INT, ®s);
  26. }